<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>lasterror</title>
  </head>
  <body bgcolor="#FFFFFF">
    <center>Scilab Function</center>
    <div align="right">Last update : 16/11/2004</div>
    <p>
      <b>lasterror</b> -  get last recorded error message</p>
    <h3>
      <font color="blue">Calling Sequence</font>
    </h3>
    <dl>
      <dd>
        <tt>str=lasterror( [opt] )  </tt>
      </dd>
      <dd>
        <tt>[str,n]=lasterror([opt])  </tt>
      </dd>
      <dd>
        <tt>[str,n,line,func]=lasterror([opt])  </tt>
      </dd>
    </dl>
    <h3>
      <font color="blue">Parameters</font>
    </h3>
    <ul>
      <li>
        <tt>
          <b>str</b>
        </tt>:  vector of character strings or an empty matrix. The last recorded error message.</li>
      <li>
        <tt>
          <b>n</b>
        </tt>:  integer, 0 or the last recorded error number.</li>
      <li>
        <tt>
          <b>line</b>
        </tt>:  integer, 0 or the last recorded function line number.</li>
      <li>
        <tt>
          <b>func</b>
        </tt>:  string,the last recorded function name</li>
      <li>
        <tt>
          <b>opt</b>
        </tt>:  boolean, if %t recorded message is cleared. Default is %t.</li>
    </ul>
    <h3>
      <font color="blue">Description</font>
    </h3>
    <p>
    Each time an error occur, the Scilab error handler records it in
    internal tables (only the last one is retained). The <tt>
        <b>lasterror</b>
      </tt>
    function allows to get the message,  the error number, the current
    function (if any) and the current line of the current function out of these
    tables.</p>
    <p>
    This function is useful while using <tt>
        <b>errcatch</b>
      </tt> or <tt>
        <b>execstr</b>
      </tt>.</p>
    <p>
    The recorded error message may be retained for a further call to
    <tt>
        <b>lasterror</b>
      </tt> using <tt>
        <b>lasterror(%f)</b>
      </tt>.</p>
    <h3>
      <font color="blue">Examples</font>
    </h3>
    <pre>

ierr=execstr('a=zzzzzzz','errcatch')
if ierr&gt;0 then disp(lasterror()),end
 
  </pre>
    <h3>
      <font color="blue">See Also</font>
    </h3>
    <p>
      <a href="errcatch.htm">
        <tt>
          <b>errcatch</b>
        </tt>
      </a>,&nbsp;&nbsp;<a href="execstr.htm">
        <tt>
          <b>execstr</b>
        </tt>
      </a>,&nbsp;&nbsp;<a href="error.htm">
        <tt>
          <b>error</b>
        </tt>
      </a>,&nbsp;&nbsp;<a href="errclear.htm">
        <tt>
          <b>errclear</b>
        </tt>
      </a>,&nbsp;&nbsp;<a href="../utilities/edit_error.htm">
        <tt>
          <b>edit_error</b>
        </tt>
      </a>,&nbsp;&nbsp;</p>
  </body>
</html>
